package com.bw.trade.service.impl;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.trade.pojo.TbTransactionLog;
import com.bw.trade.mapper.TbTransactionLogMapper;
import com.bw.trade.service.TbTransactionLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 对账信息表 服务实现类
 * </p>
 *
 * @author lv
 * @since 2021-03-23
 */
@Service
public class TbTransactionLogServiceImpl extends ServiceImpl<TbTransactionLogMapper, TbTransactionLog> implements TbTransactionLogService {

    @Autowired
    private TbTransactionLogMapper tbTransactionLogMapper;







//        clazzVo clazzVo = new clazzVo();
//        try {
//            String encoding = "UTF-8";
//            File file = new File(filePath);
//            if (file.isFile() && file.exists()){ //判断文件是否存在
//                InputStreamReader read = new InputStreamReader(
//                        new FileInputStream(file), encoding);//考虑到编码格式
//                BufferedReader bufferedReader = new BufferedReader(read);
//                String lineTxt = null;
//                while ((lineTxt = bufferedReader.readLine()) != null) {
//
//
//                    String[] s=lineTxt.split("\\|");
//                    BigDecimal big1 = new BigDecimal("" + 2.56);
//                    clazzVo.setTransactionNo(s[0].toString());
//                    clazzVo.setBillNo(s[1].toString());
//                    BigDecimal big2 = new BigDecimal(s[2].toString());
//                    clazzVo.setTransactionMoney(big2);
//                    clazzVo.setTransactionStatus(Integer.valueOf(s[3]));
//                    String t = s[4].toString() == "未处理" ? "0":s[4].toString() == "处理中" ? "1":s[4].toString() == "处理成功" ? "2":"3";
//                    clazzVo.setTransactionStatusCode(t);
//                    clazzVo.setTransactionTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(s[5].toString()));
//                    //System.out.println(lineTxt);
//
//
//                    //System.out.println(clazzVo.toString());
//                    TbTransactionLog tbTransactionLog = BeanUtil.copyProperties(clazzVo, TbTransactionLog.class);
//                    tbTransactionLogMapper.insert(tbTransactionLog);
//                    System.out.println(tbTransactionLog.toString());
//
//                }
//                read.close();
//            } else {
//                System.out.println("找不到指定的文件");
//            }
//        } catch (Exception e) {
//            System.out.println("读取文件内容出错");
//            e.printStackTrace();
//        }
//    }


}
